package extrace.ui.main;

import android.graphics.Color;
import android.os.Bundle;

import androidx.annotation.NonNull;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AppCompatActivity;
import androidx.viewpager.widget.ViewPager;

import android.view.MenuItem;
import android.view.WindowManager;
import android.widget.Toast;

import com.amap.api.services.geocoder.GeocodeQuery;
import com.amap.api.services.geocoder.GeocodeResult;
import com.amap.api.services.geocoder.GeocodeSearch;
import com.amap.api.services.geocoder.RegeocodeResult;
import com.google.android.material.bottomnavigation.BottomNavigationView;

import extrace.ui.domain.ExpressListFragment;

public class MainActivity extends AppCompatActivity implements ExpressListFragment.OnFragmentInteractionListener {




    /**
     * The {@link ViewPager} that will host the section contents.
     */
    ViewPager mViewPager;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        getSupportFragmentManager().beginTransaction().replace(R.id.host_fragment, new SecondFragment()).commit();
        if (getSupportActionBar() != null) {
            getSupportActionBar().hide();
        }

        setContentView(R.layout.activity_main2);

        getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
        getWindow().setStatusBarColor(Color.TRANSPARENT);


//        // Set up the action bar.
//        final ActionBar actionBar = getSupportActionBar();
//        assert actionBar != null;
//        actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);

        getSupportFragmentManager().beginTransaction().replace(R.id.host_fragment, new MainFragment()).commit();
        BottomNavigationView navView = findViewById(R.id.nav_view);
        navView.setOnNavigationItemSelectedListener(new BottomNavigationView.OnNavigationItemSelectedListener() {
            @Override
            public boolean onNavigationItemSelected(@NonNull MenuItem item) {

                switch (item.getItemId()) {
                    case R.id.navigation_home:

                        getSupportFragmentManager().beginTransaction().replace(R.id.host_fragment, new MainFragment()).commit();
                        return true;

                    case R.id.navigation_notifications:
                        getSupportFragmentManager().beginTransaction().replace(R.id.host_fragment, new MyFragment()).commit();
                        return true;
                }
                return false;
            }
        });



    }

    @Override
    public void onFragmentInteraction(String id) {

    }
}
